package assist.domain.model;

import java.io.Serializable;

import javax.jdo.annotations.Column;
import javax.jdo.annotations.NotPersistent;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

@PersistenceCapable(detachable = "true")
public class Team implements Serializable, Comparable<Team>
{
    @NotPersistent
    private static final long serialVersionUID = 1L;    
    @Persistent  
    private String city;
    
    @PrimaryKey
    @Persistent  
    @Column(length=20)
    private String abbreviation;
    @Persistent  
    private String nickname;
    
    @Persistent    
    private Long teamId;    
    
    public Team(final String city, final String nickname, final String abbreviation, Long teamId)
    {
        this.city = city;
        this.nickname = nickname;
        this.abbreviation = abbreviation;
        this.teamId = teamId;
    }

    public Team()
    {
        // TODO Auto-generated constructor stub
    }

    /**
     * @param abbreviation the abbreviation to set
     */
    public void setAbbreviation(String abbreviation)
    {
        this.abbreviation = abbreviation;
    }
    /**
     * @return the abbreviation
     */
    public String getAbbreviation()
    {
        return this.abbreviation;
    }

    /**
     * @return the fullName
     */
    public String getFullName()
    {
        return this.getCity() + " " + this.getNickname();
    }
    /**
     * @param city the city to set
     */
    public void setCity(String city)
    {
        this.city = city;
    }
    /**
     * @return the city
     */
    public String getCity()
    {
        return city;
    }
    /**
     * @param teamId the teamId to set
     */
    public void setTeamId(Long teamId)
    {
        this.teamId = teamId;
    }
    /**
     * @return the teamId
     */
    public Long getTeamId()
    {
        return teamId;
    }
    /**
     * @param nickname the nickname to set
     */
    public void setNickname(String nickname)
    {
        this.nickname = nickname;
    }
    /**
     * @return the nickname
     */
    public String getNickname()
    {
        return nickname;
    }

    @Override
    public int compareTo(Team team)
    {
        // TODO Auto-generated method stub
        return this.abbreviation.compareTo(team.abbreviation);
    }

}
